<?php
echo $this->Html->css(array('plugins/chosen/chosen','plugins/multiselect/multi-select'), null, array('inline' => false));
echo $this->Html->script(array('plugins/fileupload/bootstrap-fileupload.min', 'plugins/multiselect/jquery.multi-select', 'plugins/bootbox/jquery.bootbox','plugins/chosen/chosen.jquery.min'), array('inline' => false));
?>
<?php echo $this->Form->create('Anime', array('class' => 'form-vertical', 'type' => 'file')); ?>

<?php echo (empty($new) && $new != 1) ? $this->Form->input('id') : '';
echo $this->Form->input('photo_dir', array('type' => 'hidden')); ?>
<div class="span3 nomargin">
    <div class="control-group">
        <div class="controls">
            <div class="fileupload fileupload-new" data-provides="fileupload">
                <div class="fileupload-new thumbnail" style="width: 280px;">
                    <?php echo (empty($new) && $new != 1) ? $this->Html->image('anime/photo/' . $this->request->data['Anime']['id'] . '/vga_' . h($this->request->data['Anime']['photo']), array('style' => 'width:200px;')) : $this->Html->image('noImage.png'); ?>
                </div>
                <div class="fileupload-preview fileupload-exists thumbnail" style="max-width: 280px; line-height: 20px;"></div>
                <div class="">
                <span class="btn btn-block btn-file"><span class="fileupload-new"><i class="icon-folder-open"></i> Escolha uma Imagem</span><span
                        class="fileupload-exists"><i class="icon-refresh"></i> Alterar Imagem</span>
                    <?php echo $this->Form->input('photo', array('type' => 'file', 'label' => false, 'div' => false)); ?>
                    <?php echo $this->Form->input('Anime.photo_dir', array('type' => 'hidden')); ?></span>
                    <a href="#" class="btn btn-danger fileupload-exists" data-dismiss="fileupload"><i
                            class="icon-remove"></i> Excluir</a>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="span8">
    <div class="control-group">
        <div class="controls-row">
            <div class="controls span12">
                <?php echo $this->Form->input('name', array('label' => 'Nome do Anime', 'class' => 'span12', 'div' => false)); ?>
            </div>
        </div>
    </div>
    <div class="control-group">
        <div class="controls">
            <div class="input-append span12">
                <?php echo $this->Form->input('Genre', array('label' => 'Género', 'class' => 'span9 chosen-select', 'data-placeholder' => 'Escolha o Género', 'div' => false)); ?>
                <button class="btn" type="button"><i class="icon-external-link"></i></button>
            </div>

        </div>
    </div>
    <div class="control-group">
        <div class="controls-row">
            <div class="box box-color box-bordered">
                <div class="box-title">
                    <h3>
                        <i class="icon-table"></i>
                        Adicionar Temporadas
                    </h3>
                </div>
                <div class="box-content nopadding">
                    <table class="table table-icon" >
                        <thead>
                        <tr>
                            <th>Temporada</th>
                            <th>Situação</th>
                            <th>Avaliação</th>
                            <th>Ano Lançamento</th>
                            <th>Assistindo</th>
                            <th>Inicio e Fim</th>
                            <th class="text-center">Ação</th>
                        </tr>
                        </thead>
                        <?php if (!empty($seasons)): ?>
                            <tbody id="listaSeason" data-value="">
                            <?php foreach ($seasons as $season): ?>
                                <tr id="season<?php echo $season['Season']['id'];?>">
                                    <td><strong><?php echo $season['Season']['name']; ?></strong></td>
                                    <td><?php echo $season['Situation']['name']; ?></td>
                                    <td><?php echo $season['Rating']['name']; ?></td>
                                    <td><?php echo $season['Season']['release_year']; ?></td>
                                    <td><?php echo $season['Season']['dow_episodes']; ?>&nbsp;de&nbsp;<?php echo $season['Season']['full_episodes']; ?></td>
                                    <td><?php echo $season['Season']['start_season']; ?>&nbsp;de&nbsp;<?php echo $season['Season']['end_season']; ?></td>
                                    <td class="btn-group">
                                        <?php echo $this->Html->link('<i class="icon-edit"></i>', array('controller' => 'seasons', 'action' => 'edit',$season['Season']['id']), array('escape' => false, 'class' => 'btn btn-mini btn-darkblue')) ?>
                                        <a href="javascript:;" onclick="deleteSeason(<?php echo $season['Season']['id'];?>);" class="btn btn-mini btn-danger pull-right"><i class="icon-remove"></i></a>
                                    </td>
                                </tr>
                            <?php endforeach; ?>
                            </tbody>
                        <?php else: ?>
                            <tbody id="listaSeason" data-value=""><!--Season Add--></tbody>
                        <?php endif; ?>
                    </table>
                </div>
            </div>
            <div class="controls span6 pull-left nomarginleft">
                <?php echo $this->Html->link('<i class="icon-plus-sign"></i> Adicionar Temporada', array('controller' => 'animes', 'action' => 'FormSeasons'), array('escape' => false, 'class' => 'btn btn-darkblue showModal', 'id' => 'OpenSeason')) ?>
            </div>
        </div>
    </div>
    <div class="control-group">
        <div class="controls-row">
            <div class="controls span6 pull-left">
                <?php echo $this->Form->input('summary', array('label' => 'Resumo', 'class' => 'span12', 'div' => false,'escape'=>false)); ?>
            </div>
            <div class="controls span6">
                <?php echo $this->Form->input('observation', array('label' => 'Observação', 'class' => 'span12', 'div' => false)); ?>
            </div>
        </div>
    </div>
    <div class="form-actions">
        <div class="controls nomargin span2 check-line">
            <?php echo $this->Form->input('status', array('label' => false, 'div' => false, 'id' => "c5", 'class' => 'icheck-me pull-right', 'data-skin' => "square", 'data-color' => "blue")); ?>
            <label class="inline hover" for="c5">Status</label>
        </div>
        <?php echo $this->Form->button('<i class=" icon-ok"></i> Concluir', array('class' => 'btn btn-primary', 'div' => 'false', 'escape' => false)); ?>
        <?php echo $this->Html->link('<i class="icon-reply"></i> Cancelar', array('controller' => 'animes', 'action' => 'index'), array('escape' => false, 'class' => 'btn btn-danger ')) ?>
    </div>
</div>
<?php echo $this->Form->end(); ?>
<?php //echo $this->element('sql_dump'); ?>
<div id="ModalBox" class="modal hide showBox" role="dialog" style="width: 670px !important;/*left: 45% !important;*/">
    <div class="box box-bordered box-color">
        <div class="box-title">
            <h3><i class="icon-cog"></i>Cadastrar</h3>
            <div class="actions">
                <a href="#" class="btn btn-mini" data-dismiss="modal"><i class="icon-remove"></i></a>
            </div>
        </div>
        <div class="box-content cad-geral nopadding">
            <?php echo $this->Html->image('loading.gif', array('id' => '')); ?>
        </div>
    </div>
</div>